"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ProjectRole = void 0;
exports.demonstrateTypes = demonstrateTypes;
// 1. 基础数据类型
var username = "郑苗苗";
var age = 20;
var isStudent1 = true;
var undefinedVar = undefined;
var nullVar = null;
// 2. 数组类型
var skills = ["Vue3", "Spring Boot", "MySQL"];
var scores = [95, 98, 92];
var mixedArray = ["前端", 95, "后端", 98];
// 3. 元组 - 固定长度和类型的数组
var studentInfo = ["郑苗苗", 20, true];
// 4. 枚举 - 提高代码可读性
var ProjectRole;
(function (ProjectRole) {
    ProjectRole["Frontend"] = "\u524D\u7AEF\u5F00\u53D1";
    ProjectRole["Backend"] = "\u540E\u7AEF\u5F00\u53D1";
    ProjectRole["FullStack"] = "\u5168\u6808\u5F00\u53D1";
})(ProjectRole || (exports.ProjectRole = ProjectRole = {}));
var myRole = ProjectRole.FullStack;
// 5. 任意类型 - 谨慎使用
var dynamicData = "可以是任意类型";
dynamicData = 123;
dynamicData = true;
// 6. 空类型 - 常用于函数返回值
function logMessage(message) {
    console.log(message);
}
var myProfile = {
    name: "郑苗苗",
    age: 20,
    major: "软件技术",
    skills: ["Vue3", "Spring Boot", "MySQL"]
};
var myScores = [
    { courseName: "Java程序设计", score: 95, passed: true },
    { courseName: "数据库原理", score: 98, passed: true }
];
// 9. 联合类型
var id;
id = "STU2024001";
id = 2024001;
var add = function (a, b) { return a + b; };
var multiply = function (a, b) { return a * b; };
// 11. 泛型 - 提高代码复用性
function identity(arg) {
    return arg;
}
var output1 = identity("全栈开发");
var output2 = identity(100);
var myProject = {
    id: 1,
    name: "眼镜店销售决策大屏",
    techStack: ["Vue3", "ECharts", "Spring Boot"],
    status: "已上线",
    teamMembers: [
        {
            name: "郑苗苗",
            age: 20,
            major: "软件技术",
            skills: ["Vue3", "数据可视化"]
        }
    ]
};
// 13. 类型守卫
function isStudent(obj) {
    return obj && typeof obj.name === "string" && typeof obj.age === "number";
}
// 演示函数
function demonstrateTypes() {
    console.log("=== TypeScript 数据类型演示 ===");
    // 基础类型演示
    console.log("姓名:", username);
    console.log("年龄:", age);
    console.log("是否学生:", isStudent);
    // 数组和元组演示
    console.log("技术栈:", skills.join(", "));
    console.log("学生信息:", studentInfo);
    // 枚举演示
    console.log("项目角色:", myRole);
    // 对象演示
    console.log("个人档案:", myProfile);
    // 函数演示
    console.log("10 + 20 =", add(10, 20));
    console.log("10 * 20 =", multiply(10, 20));
    // 项目数据演示
    console.log("项目信息:", myProject);
    // 类型守卫演示
    if (isStudent(myProfile)) {
        console.log("".concat(myProfile.name, " \u662F\u5B66\u751F"));
    }
}
// 运行演示
demonstrateTypes();
